//
//  BDAddBusinessStep4Request.m
//  HSY
//
//  Created by 陈浩 on 2017/4/13.
//  Copyright © 2017年 金开门. All rights reserved.
//

#import "BDAddBusinessStep4Request.h"

@implementation BDAddBusinessStep4Request

- (NSString *)serviceCode{
    return BD_API_SERVICE_CODE_ADDBUSINESS_STEP4;
}

- (NSDictionary *)requestData{
    NSAssert(self.shopId.length > 0, @"店铺id不能为空");
    NSAssert(self.uid.length > 0, @"用户id不能为空");
    NSAssert(self.contactName.length > 0, @"联系人姓名不能为空");
    NSAssert(self.contactCellphone.length > 0, @"联系人手机号不能为空");
    
    NSMutableDictionary *params = [@{} mutableCopy];
    params[@"id"] = self.shopId;
    params[@"uid"] = self.uid;
    params[@"contactName"] = self.contactName;
    params[@"contactCellphone"] = self.contactCellphone;
    
    params[@"fileA"] = @"IDCARDF";
    params[@"fileB"] = @"IDCARDB";
    params[@"fileC"] = @"CONTRACT";

    return params;
}

- (NSArray<BDFileModel *> *)files{
    NSMutableArray *arr = [@[] mutableCopy];
    
    [self addFile:self.fileA withFileName:@"fileA" toArray:arr];
    [self addFile:self.fileB withFileName:@"fileB" toArray:arr];
    [self addFile:self.fileC withFileName:@"fileC" toArray:arr];

    return arr.count > 0 ? [arr copy] : nil;
}

- (void)addFile:(NSData *)file withFileName:(NSString *)fileName toArray:(NSMutableArray *)array{
    if (file) {
        BDFileModel *model = [[BDFileModel alloc] init];
        model.fileData = file;
        model.suffix = @"jpg";
        model.fileType = fileName;
        model.mimeType = @"image/png";
        
        [array addObject:model];
    }
}

- (BOOL)fileUplaod{
    return YES;
}


@end
